home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 015a / tsbat30.zip / virus.bat < prev    next >
DOS Batch File  |  1990-10-21  |  3KB  |  79 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────┐
  4. echo │ Virus testbench based on directory comparisons    │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 21-Oct-90 │
  6. echo └───────────────────────────────────────────────────┘
  7.  
  8. if "%1"=="" goto _help
  9.  
  10. rem Make an ex-ante directory for comparison, add more directories
  11. rem and files as you deem fit
  12. dir c:\*.* > tmp.$$$
  13. if exist *.exe dir *.exe >> tmp.$$$
  14. if exist *.com dir *.com >> tmp.$$$
  15. type tmp.$$$ | find /v "bytes free" > virusold.$$$
  16. if exist tmp.$$$ del tmp.$$$
  17.  
  18. rem Run the suspect program
  19. set program_=
  20. :_loop
  21. set program_=%program_% %1
  22. shift
  23. if not "%1"=="" goto _loop
  24. %program_%
  25.  
  26. rem Make an ex-post directory for the comparison
  27. dir c:\*.* > tmp.$$$
  28. if exist *.exe dir *.exe >> tmp.$$$
  29. if exist *.com dir *.com >> tmp.$$$
  30. type tmp.$$$ | find /v "bytes free" > virusnew.$$$
  31. if exist tmp.$$$ del tmp.$$$
  32.  
  33. rem Check for changes using MsDos fc.exe file compare and MsDos
  34. rem find.exe text search utility
  35. fc virusnew.$$$ virusold.$$$ > tmp.$$$
  36. type tmp.$$$ | find /v "fc: no differences encountered" > diffe.$$$
  37. del tmp.$$$
  38. if exist notsame.$$$ del notsame.$$$
  39. copy diffe.$$$ notsame.$$$ > nul
  40. if exist notsame.$$$ goto _differ
  41.  
  42. rem No changes have occurred
  43. if exist diffe.$$$ del diffe.$$$
  44. if exist virusold.$$$ del virusold.$$$
  45. if exist virusnew.$$$ del virusnew.$$$
  46. echo ┌─────────────────────────────────────────────────────────┐
  47. echo │ The scanned directories and files have not been changed │
  48. echo └─────────────────────────────────────────────────────────┘
  49. goto _out
  50.  
  51. :_differ
  52. if exist notsame.$$$ del notsame.$$$
  53. echo ┌────────────────────────────────────────────────────────────────┐
  54. echo │ Warning: The scanned directories and files have been changed   │
  55. echo │ See virusold.$$$, virusnew.$$$, and diffe.$$$ for details      │
  56. echo └────────────────────────────────────────────────────────────────┘
  57. goto _out
  58.  
  59. :_help
  60. echo.
  61. echo Usage: VIRUS SuspectProgram [parameter1] [parameter2] [...]
  62. echo.
  63. echo This batch makes a directory both prior and after running the
  64. echo suspect program, and gives a warning if the directories differ,
  65. echo and prepares a list of the differences.
  66. echo.
  67. echo This batch can be also used by a knowledgeable user for the more
  68. echo benevolent similar purpose of checking what files a certain programs
  69. echo changes.
  70. echo.
  71. echo If you get an "Out of environment space" message, increase your
  72. echo environment space by using shell configuration in config.sys:
  73. echo MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p
  74. goto _out
  75.  
  76. :_out
  77. set program_=
  78. echo on
  79.